package com.nku.mason.rpc.clientside;

import java.net.InetSocketAddress;

import com.nku.mason.rpc.serviceside.HelloService;
import com.nku.mason.rpc.serviceside.HelloServiceImpl;
import com.nku.mason.rpc.serviceside.RpcExporter;

public class RpcTest {
	public static void main(String[] args) {
		
		//先发布RPC服务
		new Thread(new Runnable() {
			
			@Override
			public void run() {
				try {
					RpcExporter.exporter("localhost", 8088);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}).start();;
		
		RpcImporter<HelloService> importer = new RpcImporter<>();
		HelloService helloService = importer.importer(HelloServiceImpl.class, new InetSocketAddress("localhost", 8088));
		System.out.println(helloService.hello("mason"));
	}
}
